package models

import "time"

// KnowledgeDoc represents a knowledge base document
type KnowledgeDoc struct {
	ID        string    `json:"id" bson:"_id"`
	Title     string    `json:"title" bson:"title"`
	Content   string    `json:"content" bson:"content"`
	Category  string    `json:"category" bson:"category"`
	Tags      []string  `json:"tags" bson:"tags"`
	Author    Author    `json:"author" bson:"author"`
	Status    string    `json:"status" bson:"status"` // draft, published, archived
	ViewCount int       `json:"viewCount" bson:"viewCount"`
	LikeCount int       `json:"likeCount" bson:"likeCount"`
	CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
}

// Author represents document author info
type Author struct {
	ID       string `json:"_id" bson:"_id"`
	Username string `json:"username" bson:"username"`
}

// CreateKnowledgeRequest represents request to create knowledge doc
type CreateKnowledgeRequest struct {
	Title    string   `json:"title" binding:"required"`
	Content  string   `json:"content" binding:"required"`
	Category string   `json:"category" binding:"required"`
	Tags     []string `json:"tags"`
	Status   string   `json:"status"` // draft or published
}

// UpdateKnowledgeRequest represents request to update knowledge doc
type UpdateKnowledgeRequest struct {
	Title    *string  `json:"title"`
	Content  *string  `json:"content"`
	Category *string  `json:"category"`
	Tags     []string `json:"tags"`
	Status   *string  `json:"status"`
}

// KnowledgeQueryParams represents query parameters for listing
type KnowledgeQueryParams struct {
	Search   string   `form:"search"`
	Category string   `form:"category"`
	Tags     []string `form:"tags"`
	Status   string   `form:"status"`
	Page     int      `form:"page"`
	PageSize int      `form:"pageSize"`
}
